//
//  ChatDAO.h
//  GolfFriend
//
//  Created by Vescky on 14-2-24.
//  Copyright (c) 2014年 vescky.org. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "BaseDao.h"
#import "DB.h"

@interface ChatDAO : BaseDao {
    
}


+ (id)shareChatDAO;

- (bool)saveMessage:(NSDictionary*)_dict;
- (bool)saveMessages:(NSMutableArray*)_arr;

- (NSString*)getOneMessageByUserId:(NSString*)_uId;//取一条消息
- (NSDictionary*)getLatestMessageByUserId:(NSString*)_uId;//获取某个用户最后一条消息
- (NSMutableArray*)getMessagesByUserId:(NSString*)_uId;//取默认值，50条
- (NSMutableArray*)getMessagesByUserId:(NSString*)_uId range:(NSRange)_range;
- (NSMutableArray*)getUnreadMessageByUserId:(NSString*)_uId;

- (long)getLatestMsgId;//

- (bool)readMessage:(NSString*)msgId;
- (bool)readUserMessage:(NSString*)_uId;

- (NSMutableArray*)getAllUnreadMessages;

- (bool)deleteUserMessages:(NSString*)userId;
- (bool)cleanAllMessages;

@end
